package com.gaowl.yygh.hosp.controller;
/*
*  处理和科室相关的请求
* */

import com.gaowl.yygh.commom.result.Result;
import com.gaowl.yygh.hosp.service.DepartmentService;
import com.gaowl.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/hosp/department")
//@CrossOrigin  // Gateway网关中已统一进行了跨域处理
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    // 根据医院编号，查询该医院所有的科室列表
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDeptList/{hoscode}")
    public Result getDeptList(@PathVariable String hoscode) {
        List<DepartmentVo> list = departmentService.findDeptTree(hoscode);
        return Result.ok(list);
    }
}
